Default unit for all Xen memory parameters is kilobytes.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 19 Aug 2005 09:16:56 +0000 (09:16 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 19 Aug 2005 09:16:56 +0000 (09:16 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
docs/src/user.tex
xen/arch/x86/domain_build.c
xen/common/lib.c

index da41a813dc552ac5f9981c94602527cdb9198263..3ee4a24fbcf2ef30485834e49e46778662951190 100644 (file)
@@ -1763,7 +1763,7 @@ editing \path{grub.conf}.
  physical address in the memory map will be ignored. This parameter
  may be specified with a B, K, M or G suffix, representing bytes,
  kilobytes, megabytes and gigabytes respectively. The
- default unit, if no suffix is specified, is bytes.
+ default unit, if no suffix is specified, is kilobytes.
 
 \item [dom0\_mem=xxx ] 
  Set the amount of memory to be allocated to domain0. In Xen 3.x the parameter
index b9941763c4807ee07769e02456084e830a0f5acc..cc3f3b6d7896dfcd814cd27d242a70a900ba44dd 100644 (file)
 #include <asm/i387.h>
 #include <asm/shadow.h>
 
-/* opt_dom0_mem: memory allocated to domain 0. */
-static unsigned int opt_dom0_mem;
+static unsigned long dom0_nrpages;
 static void parse_dom0_mem(char *s)
 {
     unsigned long long bytes = parse_size_and_unit(s);
-    /* If no unit is specified we default to kB units, not bytes. */
-    if ( isdigit(s[strlen(s)-1]) )
-        opt_dom0_mem = (unsigned int)bytes;
-    else
-        opt_dom0_mem = (unsigned int)(bytes >> 10);
+    dom0_nrpages = bytes >> PAGE_SHIFT;
 }
 custom_param("dom0_mem", parse_dom0_mem);
 
@@ -139,7 +134,7 @@ int construct_dom0(struct domain *d,
 
     /* By default DOM0 is allocated all available memory. */
     d->max_pages = ~0U;
-    if ( (nr_pages = opt_dom0_mem >> (PAGE_SHIFT - 10)) == 0 )
+    if ( (nr_pages = dom0_nrpages) == 0 )
         nr_pages = avail_domheap_pages() +
             ((initrd_len + PAGE_SIZE - 1) >> PAGE_SHIFT) +
             ((image_len  + PAGE_SIZE - 1) >> PAGE_SHIFT);
index 764ad7143d1eaf11e8c2efcbe7fa5f9c5b645d42..1eb70fe6c4b3320e74a3310c88e30541b19afd11 100644 (file)
@@ -450,8 +450,10 @@ unsigned long long parse_size_and_unit(char *s)
                ret <<= 10;
        case 'M': case 'm':
                ret <<= 10;
-       case 'K': case 'k':
+       case 'K': case 'k': default:
                ret <<= 10;
+       case 'B': case 'b':
+               break;
        }
 
        return ret;